def getMenuOption(debug = False):
	if debug:
		print "getMenuOption Function"
	validInput = False
	while not validInput:
		option = raw_input("> ")
		option = option.lower()
		if (option == "1" or
			option == "story 1"):
				option = "1"
				validInput = True
		elif (option == "2" or
			option == "story 2"):
				option = "2"
				validInput = True
		elif (option == "3" or
			option == "story 3"):
				option = "3"
				validInput = True
		elif (option == "q" or
			option == "quit"):
				option = "quit"
				validInput = True
		elif (option == "0" or
			option == "story 0"):
				option = "0"
				validInput = True
		elif (option == "o" or 
			option == "options"):
			option = "o"
			validInput = True
		elif (option == "exit" or
			  option == "x" or
			  option == "e"):
				  option = "exit"
				  validInput = True
		else:
			print "please type a valid option"
			validInput = False
	if debug:
		print "Option is:", option
	return option
			


def getWord(prompt, debug = False):
	if debug:
		print "getWord Function", prompt
	validInput = False
	while not validInput:
		option = raw_input(prompt)
		validInput = True
		if option == "":
			print "please type a word"
			validInput = False
		elif isSwear(option, debug):
			print "Don't say that!"			
			validInput = False
		elif isNumber(option, debug):
			print "please type a word"
			validInput = False
	if debug:
		print "Option:", option 
	return option



def getNumber(prompt, debug = False):
	if debug:
		print "getNumber Function", prompt
	validInput = False
	while not validInput:
		option = raw_input(prompt)
		allowedChars = "1234567890.,"
		validInput = True
		for letter in option:
			if debug:
				print letter
			if not(letter in allowedChars):
				validInput = False
		if not validInput:
			print "please type a number"
	if debug:
		print "Option: ", option
	return option
			


def isSwear(word, debug = False):
	if debug: 
		print "In isSwear Function", word
	swearList = ["shit",
				 "fuck",
				 "fucker",
				 "motherfucker",
				 "cunt",
				 "bitch",
				 "bastard",
				 "ass",
				 "asshole",
				 "damn",
				 "crap",
				 "dick",
				 "cock",
				 "penis",
				 "vagina",
				 "dyke",
				 "faggot",
				 "fag",
				 "cocksucker",
				 "whore"]
	if word.lower() in swearList:
		return True
	else:
		return False
	


def isNumber(word, debug = False):
	if debug:
		print "isNumber Function", word
	numbers = "123456789.,"
	validInput = True
	for letter in word:
		if debug:
			print letter
		if not letter in numbers:
			return False
	return True
	
	
	
def isState(word, debug = False):
	if debug:
		print "isNumber Function", word
	stateList = ["Alabama",
				"Alaska", 
				"Arizona", 
				"Arkansas", 
				"California", 
				"Colorado", 
				"Connecticut", 
				"Delaware", 
				"Florida", 
				"Georgia", 
				"Hawaii", 
				"Idaho", 
				"Illinois",
				"Indiana", 
				"Iowa", 
				"Kansas", 
				"Kentucky", 
				"Louisiana", 
				"Maine", 
				"Maryland", 
				"Massachusetts", 
				"Michigan", 
				"Minnesota", 
				"Mississippi", 
				"Missouri", 
				"Montana",
				"Nebraska", 
				"Nevada", 
				"New Hampshire", 
				"New Jersey", 
				"New Mexico", 
				"New York", 
				"North Carolina", 
				"North Dakota", 
				"Ohio", 
				"Oklahoma", 
				"Oregon", 
				"Pennsylvania",
				"Rhode Island", 
				"South Carolina", 
				"South Dakota", 
				"Tennessee", 
				"Texas", 
				"Utah", 
				"Vermont", 
				"Virginia", 
				"Washington", 
				"West Virginia", 
				"Wisconsin", 
				"Wyoming"]
	if word.title() in stateList:
		return True
	else:
		return False


			
def getState(prompt, debug = False):
	if debug:
		print "getState Function: ", prompt
	validInput = False
	while not validInput:
		option = raw_input(prompt)
		if isState(option, debug):
			validInput = True
		else:
			validInput = False
		if not validInput:
			print "please name a state"
	if debug:
		print "Option: ", option
	return option
	
	
	
def isCountry(word, debug = False):
	if debug:
		print "isCountry Function", word
	countryList = ["Albania",
					"Andorra",
					"Armenia",
					"Austria",
					"Azerbaijan",
					"Belarus",
					"Belgium",
					"Bosnia",
					"Herzegovina",
					"Bulgaria",
					"Croatia",
					"Cyprus",
					"Czech Republic",
					"Denmark",
					"Estonia",
					"Finland",
					"France",
					"Georgia",
					"Germany",
					"Greece",
					"Hungary",
					"Iceland",
					"Ireland",
					"Italy",
					"Kosovo",
					"Latvia",
					"Liechtenstein",
					"Lithuania",
					"Luxembourg",
					"Macedonia",
					"Malta",
					"Moldova",
					"Monaco",
					"Montenegro",
					"Netherlands",
					"Norway",
					"Poland",
					"Portugal",
					"Romania",
					"Russia",
					"San Marino",
					"Serbia",
					"Slovakia",
					"Slovenia",
					"Spain",
					"Sweden",
					"Switzerland",
					"Turkey",
					"Ukraine",
					"United Kingdom",
					"Vatican City"]
	if word.title() in countryList:
		return True
	else:
		return False 



def getCountry(prompt, debug = True):
	if debug:
		print "getCountry Function: ", prompt
	validInput = False
	while not validInput:
		option = raw_input(prompt)
		if isCountry(option, debug):
			validInput = True
		else:
			validInput = False
		if not validInput:
			print "please name a country"
	if debug:
		print "Option: ", option
	return option
		


def getAnything(prompt, debug = False):
	if debug:
		print "getAnything Function", prompt
	validInput = False
	while not validInput:
		option = raw_input(prompt)
		validInput = True
		if option == "":
			print "please type something"
			validInput = False
		elif isSwear(option, debug):
			print "Don't say that!"			
			validInput = False
	if debug:
		print "Option:", option 
	return option



def isContinent(word, debug = False):
	if debug:
		print "isContinent Function", word
	continentList = ["North America", 
					"South America",
					"Africa", 
					"Europe",
					"Asia", 
					"Antarctica",
					"Australia"]
	if word.title() in continentList:
		return True
	else:
		return False



def getContinent(prompt, debug = False):
	if debug:
		print "getContinent Function", prompt
	validInput = False
	while not validInput:
		option = raw_input(prompt)
		if isContinent(option, debug):
			validInput = True
		else:
			validInput = False
		if not validInput:
			print "please name a continent"
	if debug:
		print "Option: ", option
	return option	
